import ComponentBase from "./ComponentBase";
import Manager from "./Manager";
import Message from "./Message";

const {ccclass, property} = cc._decorator;

export default class ManagerCenter {
    // 管理类类别
    static Managers: Manager[] = [];

    // 发送消息
    static sendMsg(msg: Message) {
        // 给所有管理类转发消息
        for(let manager of this.Managers) {
            manager.ReceiveMsg(msg);
        } 
    }
    // 简化发送消息
    static SendCustomMsg(Type: number, Command: number, Content: any){
        let msg = new Message(Type, Command, Content);
        this.sendMsg(msg);
    }
}
